/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package co.com.entidades;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author 839398
 */
@Entity
@Table(name = "tbl_insumos")
@NamedQueries({
    @NamedQuery(name = "TblInsumos.findAll", query = "SELECT t FROM TblInsumos t"),
    @NamedQuery(name = "TblInsumos.findByCodInsumo", query = "SELECT t FROM TblInsumos t WHERE t.codInsumo = :codInsumo"),
    @NamedQuery(name = "TblInsumos.findByDescripcion", query = "SELECT t FROM TblInsumos t WHERE t.descripcion = :descripcion")})
public class TblInsumos implements Serializable {
    private static final long serialVersionUID = 1L;
    
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "cod_insumo")
    private Integer codInsumo;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 25)
    
    
    @Column(name = "descripcion")
    private String descripcion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tblInsumos")
    private List<TblInsumoActividad> tblInsumoActividadList;

    public TblInsumos() {
    }

    public TblInsumos(Integer codInsumo) {
        this.codInsumo = codInsumo;
    }

    public TblInsumos(Integer codInsumo, String descripcion) {
        this.codInsumo = codInsumo;
        this.descripcion = descripcion;
    }

    public Integer getCodInsumo() {
        return codInsumo;
    }

    public void setCodInsumo(Integer codInsumo) {
        this.codInsumo = codInsumo;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public List<TblInsumoActividad> getTblInsumoActividadList() {
        return tblInsumoActividadList;
    }

    public void setTblInsumoActividadList(List<TblInsumoActividad> tblInsumoActividadList) {
        this.tblInsumoActividadList = tblInsumoActividadList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codInsumo != null ? codInsumo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TblInsumos)) {
            return false;
        }
        TblInsumos other = (TblInsumos) object;
        if ((this.codInsumo == null && other.codInsumo != null) || (this.codInsumo != null && !this.codInsumo.equals(other.codInsumo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "" + descripcion;
    }
    
}
